//
//  HomeViewController.m
//  SmartWatch
//
//  Created by janshky on 2022/11/18.
//

#import "HomeViewController.h"
#import "ScanViewController.h"
#import "HealthReportViewController.h"
#import "RemindViewController.h"
#import "HealthViewController.h"
#import "AdjustViewController.h"
#import "ClockSetViewController.h"
#import "FindWatchViewController.h"
#import "TestListViewController.h"
#import "FaceMonitorViewController.h"
//#import "BodyTestViewController.h"
//#import "MaiXingTuViewController.h"
//#import "HealthIndexViewController.h"
//#import "HealthDetailViewController.h"
//#import "AnalyReportViewController.h"
//#import "OrganDetailViewController.h"
//#import "OrganDetailSingleViewController.h"
//#import "OrganDetailInfoViewController.h"
//#import "OrganChartViewController.h"
//#import "CustomDateViewController.h"
//#import "FaceLivenessViewController.h"
@interface HomeViewController ()

@property (nonatomic,strong) UIView *contanerView;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.statusBarDefault = YES;
    self.isHideNavigationBar = YES;
    
    FlexFrameView *flexView = [[FlexFrameView alloc] initWithFlex:@"HomeViewController" Frame:self.view.bounds Owner:self];
    [self.view addSubview:flexView];
    [flexView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
        make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
        make.top.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
    
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setGradientLayerForContainer) name:FLEXDIDLAYOUT object:nil];
}

- (void)setGradientLayerForContainer {
    CAGradientLayer *gl = [CAGradientLayer layer];
    gl.frame = self.contanerView.bounds;
    gl.startPoint = CGPointMake(0.5, 0);
    gl.endPoint = CGPointMake(0.5, 1);
    gl.colors = @[(__bridge id)[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:248/255.0 green:250/255.0 blue:250/255.0 alpha:1.0].CGColor];
    gl.locations = @[@(0), @(1.0f)];
    UIGraphicsBeginImageContext(self.contanerView.size);
    [gl renderInContext:UIGraphicsGetCurrentContext()];
    UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.contanerView.backgroundColor = [UIColor colorWithPatternImage:image];
    
    
}


// 扫码
- (void)scanClick {
    if (TARGET_IPHONE_SIMULATOR){
        [QMUITips showError:@"请使用手机扫一扫" inView:self.view hideAfterDelay:2];
    }else{
        ScanViewController *vc = [[ScanViewController alloc]init];
        [self showViewController:vc sender:self];
    }
    
}

// 自我检测
- (void)monitorClick{
//    FaceLivenessViewController *vc = FaceLivenessViewController.new;
    FaceMonitorViewController *vc = FaceMonitorViewController.new;
//    BodyTestViewController *vc  = BodyTestViewController.new;
//    MaiXingTuViewController *vc = MaiXingTuViewController.new;
//    HealthIndexViewController *vc = HealthIndexViewController.new;
//    HealthDetailViewController *vc = HealthDetailViewController.new;
//    AnalyReportViewController *vc = AnalyReportViewController.new;
//    OrganDetailViewController *vc = OrganDetailViewController.new;
//    OrganDetailSingleViewController *vc = OrganDetailSingleViewController.new;
//    OrganDetailInfoViewController *vc = OrganDetailInfoViewController.new;
//    OrganChartViewController *vc  = OrganChartViewController.new;
//    CustomDateViewController *vc = CustomDateViewController.new;
    [self showViewController:vc sender:self];
}
// 大众检测
- (void)allTestClick {
    TestListViewController *vc = TestListViewController.new;
    [self showViewController:vc sender:self];
}
// 健康报告
- (void)healthReportClick {
    HealthReportViewController *vc = HealthReportViewController.new;
    [self showViewController:vc sender:self];
}
// 提醒
- (void)remindCLick {
    RemindViewController *vc = RemindViewController.new;
    [self showViewController:vc sender:self];
}

// 女性健康
- (void)healthClick {
    HealthViewController *vc = HealthViewController.new;
    [self showViewController:vc sender:self];
}

// 调理
- (void)adjustClick {
    AdjustViewController *vc = AdjustViewController.new;
    [self showViewController:vc sender:self];
}

// 闹钟设置
- (void)clockClick {
    ClockSetViewController *vc = ClockSetViewController.new;
    [self showViewController:vc sender:self];
}
// 查找手表
- (void)jumpToFindWatch {
    FindWatchViewController *vc = FindWatchViewController.new;
    [self showViewController:vc sender:self];
}
// 更多服务
- (void)moreServiceClick {
    self.tabBarController.selectedIndex = 1;
}

@end
